/**
 * @param {number} rowIndex
 * @return {number[]}
 */
var yhLine = function(n) {
  if (n == 1) return [1]
  else if (n == 2) return [1, 1]

  var lastYh = yhLine(n - 1)
  var result = [1]
  for (var i = 0; i < n - 2; i++) {
    result.push(lastYh[i] + lastYh[i + 1])
  }
  result.push(1)
  return result
}

var getRow = function(rowIndex) {
  return yhLine(rowIndex + 1)
}

console.log(getRow(100))
